﻿using AutoMapper;
using Modules;
using Modules.Person;
using PmSoft;

namespace AppWebApi.Models.Dtos
{
    public class PersonInfoDto
    {
        /// <summary>
        /// 人员ID 
        ///</summary>
        public int PersonId { get; set; }

        /// <summary>
        /// 企业ID 
        ///</summary>
        public int CorpId { get; set; }
        /// <summary>
        /// 人员姓名 
        ///</summary>
        public string Name { get; set; }
        /// <summary>
        /// 身份证号
        /// </summary>
        public string CardNumber { get; set; }
        /// <summary>
        /// 性别 
        ///</summary>
        public byte? Gender { get; set; }
        /// <summary>
        /// 出生日期 
        ///</summary>
        public DateTime? Birthday { get; set; }
        /// <summary>
        /// 婚姻状况 参考婚姻状况字典表 
        ///</summary>
        public byte? MaritalStatus { get; set; }
        /// <summary>
        /// 发证机关 
        ///</summary>
        public string CardOrg { get; set; }
        /// <summary>
        /// 手机号码 
        ///</summary>
        public string Mobile { get; set; }
        /// <summary>
        /// 身份证上民族信息，如：汉，回，藏等 
        ///</summary>
        public string Nation { get; set; }
        /// <summary>
        /// 住址 
        ///</summary>
        public string Address { get; set; }
        /// <summary>
        /// 政治面貌 参考政治面貌字典表 
        ///</summary>
        public byte? PoliticsType { get; set; }
        /// <summary>
        /// 加入工会时间。如果加入工会，此字段必填 
        ///</summary>
        public DateTime? JoinedTime { get; set; }
        /// <summary>
        /// 是否购买工伤或意外伤害保险 。参考是否字典表 
        ///</summary>
        public bool? HasBuyInsurance { get; set; }
        /// <summary>
        /// 是否有重大病史。参考是否字典表 
        ///</summary>
        public bool? HasBadMedicalHistory { get; set; }
        /// <summary>
        /// 创建日期 
        ///</summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 身份证照片
        /// </summary>
        public string? Base64PhotoStr { get; set; }

        #region 扩展字段
        /// <summary>
        /// 人脸动作
        /// </summary>
        public int[] Actions { get; set; }
        /// <summary>
        /// 识别唯一标识
        /// </summary>
        public string ScanCode { get; set; }
        #endregion
    }

    public static partial class PersonInfoExceptions
    {
        public static PersonInfoDto AsDto(this PersonInfo personInfo)
        {

            return ServiceAccessor.GetService<IMapper>().Map(personInfo, new PersonInfoDto());
        }


    }
}
